<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>酒店基础设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">

</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">酒店基础设置</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" lay-filter="settingForm">
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">酒店名称</label>
                            <div class="layui-input-inline" style="width:330px;">
                                <input type="text" value="{$hotel.hotel_name}" name="hotel_name" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">酒店电话</label>
                            <div class="layui-input-inline" style="width:330px;">
                                <input type="text" value="{$hotel.hotel_tel}" name="hotel_tel" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                          <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">酒店地区</label>
                            <div class="layui-inline">
                                <select name="province" class="province" lay-verify="required" lay-search lay-filter="province">
                                    <option value="山东省">山东省</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <select name="city" class="city" lay-verify="required" lay-search lay-filter="city">
                                    <option value="临沂市">临沂市</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <select name="district" class="district" lay-verify="required" lay-search>
                                    <option value="沂水县">县/沂水县</option>
                                </select>
                            </div>
                        </div>  
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">详细地址</label>
                            <div class="layui-input-inline" style="width:330px;">
                                <input type="text" value="{$hotel.address}" name="address" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">酒店类别</label>
                            <div class="layui-input-inline" style="width: 330px;">
                                <select name="kind_type" lay-verify="required">
                                    <option value=""></option>
                                    <option value="1" {if condition="$hotel.kind_type == 1"}selected="selected"{/if}>星级酒店</option>
                                    <option value="2" {if condition="$hotel.kind_type == 2"}selected="selected"{/if}>民宿客栈</option>
                                    <option value="3" {if condition="$hotel.kind_type == 3"}selected="selected"{/if}>快捷酒店</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">酒店标签</label>
                            <div class="layui-input-inline" style="width:330px;">
                                <input type="text" value="{$hotel.hotel_tag}" name="hotel_tag" lay-verify="required" placeholder="请输入景点标签，多个标签用英文逗号（,）隔开" autocomplete="off" class="layui-input">
                            </div>
                            <label class="layui-form-label" style="width:200px;">多个标签用英文逗号（,）隔开</label>
                        </div>
                         <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;">预订最晚到店时间</label>
                            <div class="layui-input-inline" style="width:330px;">
                                <input type="text" value="{$hotel.latest_time}" name="latest_time" lay-verify="required"  autocomplete="off" placeholder="HH:mm:ss" class="layui-input"  id="test4">
                            </div> 
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:130px;padding-top: 0;padding-bottom:0;height: 105px;line-height: 105px;">酒店缩略图</label>
                            <div class="layui-input-inline" style="border:1px solid #888888;width:105px;height: 105px;">
                                <img src="{$hotel.hotel_covers}" id="hotel_covers_src" style=" display:block;width:105px;height: 105px;" alt="">
                            </div>
                            <div class="layui-input-inline" style="padding-top: 0;padding-bottom:0;height: 105px;line-height: 105px;">
                                <a class="layui-btn" id="upload_covers_button">上传</a>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label" style="width:130px;">酒店介绍</label>
                            <div class="layui-input-inline" style="width:80%;">
                                <textarea name="hotel_subject" placeholder="请输入内容" style="height:150px;" class="layui-textarea">{$hotel.hotel_subject}</textarea>
                            </div>
                        </div> 
                        <div class="layui-form-item layui-layout-admin">
                            <div class="layui-input-block" style="margin-left: 170px;">
                                <div class="layui-inline" style="left: 0;">
                                    <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sureSubmit">确定</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>



<script src="/static/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="/ueditor/lang/zh-cn/zh-cn.js"></script>

<script>
    layui.use('laydate', function(){
     var laydate = layui.laydate;
      laydate.render({
        elem: '#test4'
        ,type: 'time' 
      }); 
    });

    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate','set','upload'], function(){
        $ = layui.jquery;
        var table = layui.table
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,upload = layui.upload
            ,form = layui.form;

        form.render('select');

        //时间范围选择
        laydate.render({
            elem: '#tour_time'
            ,type: 'time'
            ,format: 'HH:mm' //可任意组合
            ,range: true //或 range: '~' 来自定义分割字符
        });

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#upload_covers_button'
            ,url: "{:url('Hotel/uploadCoverImg')}"
            ,done: function(res){
                if (res.code == 1){
                    return layer.msg(res.msg,{time:1500},function(){
                        $('#hotel_covers_src').attr('src',res.data);
                    });
                }else{
                    return layer.msg(res.msg);
                }
            }
        });

        //添加提交
        form.on('submit(sureSubmit)', function(data){
            var loading = layer.load(1, {
                shade: [0.1,'#fff'] //0.1透明度的白色背景
            });

            $.ajax({
                url: "{:url('Hotel/editHotelInfo')}",
                type: 'post',
                dataType: 'json',
                data: {data:data.field},
                success: function(data){
                    if (data.code === 0) {
                        layer.close(loading);
                        layer.msg('修改成功',{icon:1,time:2000});
                    }else{
                        layer.close(loading);
                        layer.msg(data.code,{icon:2,time:1000})
                    }
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        UE.getEditor(
            'should_konwn',
            {
                initialFrameWidth:'100%'
                ,initialFrameHeight:500
                , toolbars: [[
                    'fullscreen', 'source', '|', 'undo', 'redo', '|',
                    'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                    'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                    'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                    'directionalityltr', 'directionalityrtl', 'indent', '|',
                    'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                    'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
                    'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
                    'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
                ]]
            }
        );

    });

</script>


</body>
</html>